package com.bw.user.mvvm.viewmodel;

import androidx.databinding.ObservableField;

import com.blankj.utilcode.util.ToastUtils;
import com.bw.mvvm_comom.entity.BaseEntity;
import com.bw.mvvm_comom.mvvm.BaseViewModel;
import com.bw.user.mvvm.model.ResetPwdModel;

import java.util.HashMap;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

public class ResetPwdViewModel extends BaseViewModel<ResetPwdModel> {
    public ObservableField<String> confirmpwd = new ObservableField<>();
    public ObservableField<String> pwd = new ObservableField<>();
    @Override
    public void onCreate() {
        super.onCreate();


    }


    public void confirm(){
        if (confirmpwd.get().isEmpty()){
            ToastUtils.showShort("请输入手机号");
            return;
        }
        if (pwd.get().isEmpty()){
            ToastUtils.showShort("请输入密码");
            return;
        }
        HashMap<String,Object> map = new HashMap<>();
        map.put("mobile",pwd.get());
        map.put("pwd",confirmpwd.get());
        m.requestResetPwdModel(map)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(this);

        getUiChange().getFinishActObServAble().setValue(""+System.currentTimeMillis());
    }
    public void finish(){
        getUiChange().getFinishActObServAble().setValue(""+System.currentTimeMillis());
    }

    @Override
    protected void result(BaseEntity baseEntity) {

    }
}
